package com.boyon.common.status;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.boyon.common.domain.Value;

/**
 * ClassName:AccountType <br/>
 * Function: 账号类型. <br/>
 * Date: 2018年3月13日 下午10:11:20 <br/>
 * 
 * @author sunshulin
 * @version
 * @since JDK 1.8
 * @see
 */
public enum AccountType {

	system(0, "系统账号"), manager(1, "管理账号"), user(2, "用户账号");

	private Integer val;

	private String desc;

	private static Map<Integer, AccountType> values = new HashMap<>();

	private static List<Value> list = new ArrayList<>();

	static {
		values.put(AccountType.system.getVal(), AccountType.system);
		values.put(AccountType.manager.getVal(), AccountType.manager);
		values.put(AccountType.user.getVal(), AccountType.user);
		list.add(new Value(AccountType.system.val, AccountType.system.desc));
		list.add(new Value(AccountType.manager.val, AccountType.manager.desc));
		list.add(new Value(AccountType.user.val, AccountType.user.desc));
	}

	/**
	 * Creates a new instance of AccountType.
	 * 
	 * @param status
	 * @param desc
	 */
	private AccountType(Integer val, String desc) {
		this.val = val;
		this.desc = desc;
	}

	/**
	 * status.
	 * 
	 * @return the status
	 * @since JDK 1.8
	 */
	public Integer getVal() {
		return val;
	}

	/**
	 * desc.
	 * 
	 * @return the desc
	 * @since JDK 1.8
	 */
	public String getDesc() {
		return desc;
	}

	/**
	 * 
	 * getType:获取枚举类型. <br/>
	 * 
	 * @author sunshulin
	 * @param val
	 * @return
	 * @since JDK 1.8
	 */
	public static AccountType getType(Integer val) {
		return values.get(val);
	}

	/**
	 * list.
	 * 
	 * @return the list
	 * @since JDK 1.8
	 */
	public static List<Value> getList() {
		return list;
	}

}
